package com.wenxixuanwu.fruitstore.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author :小凡凡
 * @version :1.0
 * @Project :fruitstore
 * @Date :2022/5/10
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Value("${BannerSavePath.ProductfileUrl}")
    private String ProductFileUrl;

    @Value("${BannerSavePath.ProductfileUrlMapper}")
    private String ProductFileUrlMapper;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(ProductFileUrlMapper + "**")
                .addResourceLocations("file:" + ProductFileUrl);
    }
}
